package cn.websocket.pojo;

import cn.websocket.valid.common.ValidComment;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import jakarta.validation.groups.Default;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * <h3>WebSocket</h3>
 * <p></p>
 *
 * @author gdw
 * @since 2025-08-18 09:48:21
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("socket_user")
public class User implements Serializable {
    private static final long serialVersionUID = 1L;
    @NotNull(message = "用户id不能为空",groups = {ValidComment.Update.class,ValidComment.Delete.class,ValidComment.Query.class})
    private Long id;
    @NotBlank(message = "手机号不能为空",groups = {ValidComment.Create.class,ValidComment.Login.class})
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式错误",groups = {ValidComment.Create.class,ValidComment.Login.class})
    private String phone;
    @NotBlank(message = "用户名不能为空",groups = ValidComment.Create.class)
    private String userName;
    @NotBlank(message = "密码不能为空",groups = {ValidComment.Create.class,ValidComment.Login.class})
    @Size(min = 6, max = 20, message = "密码长度需6-20位",groups = {ValidComment.Create.class,ValidComment.Login.class})
    private String userPassword;
    @NotBlank(message = "用户头像不能为空",groups = ValidComment.Create.class)
    private String userAvatarUrl;
    @TableField(exist = false)
    @NotBlank(message = "验证码不能为空",groups = {ValidComment.Create.class})
    private String code;
    private String remark;
}
